﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SZSLSystem.Model;
using SZSLSystem.DAL;

namespace SZSLSystem.BLL
{
    /// <summary>
    /// 业务逻辑层 客户
    /// </summary>
    public partial class Customer
    {
        private readonly SZSLSystem.DAL.Customer dal = new DAL.Customer();

        public Customer()
        {

        }

        #region  Method

        /// <summary>
        ///  判断是否存在
        /// </summary>
        /// <param name="Id">管理员编号</param>
        /// <returns></returns>
        public bool Exists(Guid Id)
        {
            return dal.Exists(Id);
        }

        /// <summary>
        ///  判断客户姓名是否存在
        /// </summary>
        /// <param name="UserName">客户姓名</param>
        /// <returns></returns>
        public bool Exists(string CustomerName)
        {
            return dal.Exists(CustomerName);
        }

        /// <summary>
        /// 返回数据总数
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        /// <returns></returns>
        public int GetCount(string strWhere)
        {
            return dal.GetCount(strWhere);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model">管理员信息实体</param>
        /// <returns></returns>
        public int Add(SZSLSystem.Model.Customer model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新客户
        /// </summary>
        /// <param name="model">客户信息实体</param>
        /// <returns></returns>
        public bool Update(SZSLSystem.Model.Customer model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除客户
        /// </summary>
        /// <param name="Id">客户编号</param>
        /// <returns></returns>
        public bool Delete(Guid Id)
        {
            return dal.Delete(Id);
        }

        /// <summary>
        /// 根据客户姓名获取数据
        /// </summary>
        /// <param name="userName">客户姓名</param>
        /// <returns></returns>
        public SZSLSystem.Model.Customer GetModel(string CustomerName)
        {
            return dal.GetModel(CustomerName);
        }

        /// <summary>
        /// 根据客户编号获取数据
        /// </summary>
        /// <param name="Id">客户编号</param>
        /// <returns></returns>
        public SZSLSystem.Model.Customer GetModel(Guid Id)
        {
            return dal.GetModel(Id);
        }

        /// <summary>
        /// 获得客户数据列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        /// <returns></returns>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        /// <summary>
        /// 获得客户前几行数据
        /// </summary>
        /// <param name="Top">行数</param>
        /// <param name="strWhere">查询条件</param>
        /// <param name="filedOrder">排序条件</param>
        /// <returns></returns>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }

        /// <summary>
        /// 获得管客户查询分页数据
        /// </summary>
        /// <param name="pageSize">每页数目</param>
        /// <param name="currentPage">当前页数</param>
        /// <param name="strWhere">查询条件</param>
        /// <param name="filedOrder">排序条件</param>
        /// <returns></returns>
        public DataSet GetPageList(int pageSize, int currentPage, string strWhere, string filedOrder)
        {
            return dal.GetPageList(pageSize, currentPage, strWhere, filedOrder);
        }

        #endregion  Method
    }
}
